home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / pmake / lst / RCS / lstDeQueue.c,v < prev    next >
Encoding:
Text File  |  1992-05-19  |  1.7 KB  |  81 lines

  1. head     1.5;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.5
  10. date     88.11.17.20.52.11;  author adam;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 1.5
  21. log
  22. @checked in with -k by kupfer at 92.05.18.17.32.35.
  23. @
  24. text
  25. @/*-
  26.  * LstDeQueue.c --
  27.  *    Remove the node and return its datum from the head of the list
  28.  *
  29.  * Copyright (c) 1988 by University of California Regents
  30.  *
  31.  * Permission to use, copy, modify, and distribute this
  32.  * software and its documentation for any purpose and without
  33.  * fee is hereby granted, provided that the above copyright
  34.  * notice appears in all copies.  Neither the University of California nor
  35.  * Adam de Boor makes any representations about the suitability of this
  36.  * software for any purpose.  It is provided "as is" without
  37.  * express or implied warranty.
  38.  */
  39. #ifndef lint
  40. static char *rcsid =
  41. "$Id: lstDeQueue.c,v 1.5 88/11/17 20:52:11 adam Exp $ SPRITE (Berkeley)";
  42. #endif lint
  43.  
  44. #include    "lstInt.h"
  45.  
  46. /*-
  47.  *-----------------------------------------------------------------------
  48.  * Lst_DeQueue --
  49.  *    Remove and return the datum at the head of the given list.
  50.  *
  51.  * Results:
  52.  *    The datum in the node at the head or (ick) NIL if the list
  53.  *    is empty.
  54.  *
  55.  * Side Effects:
  56.  *    The head node is removed from the list.
  57.  *
  58.  *-----------------------------------------------------------------------
  59.  */
  60. ClientData
  61. Lst_DeQueue (l)
  62.     Lst              l;
  63. {
  64.     ClientData      rd;
  65.     register ListNode    tln;
  66.     
  67.     tln = (ListNode) Lst_First (l);
  68.     if (tln == NilListNode) {
  69.     return ((ClientData) NIL);
  70.     }
  71.     
  72.     rd = tln->datum;
  73.     if (Lst_Remove (l, (LstNode)tln) == FAILURE) {
  74.     return ((ClientData) NIL);
  75.     } else {
  76.     return (rd);
  77.     }
  78. }
  79.  
  80. @
  81.